package com.spring;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;

/**
 * Created by peak on 2016/1/6.
 */
public class JdbcTemplateTest {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring.xml");
        JdbcTemplate jdbcTemplate = (JdbcTemplate)context.getBean("jdbcTemplate");
//        jdbcTemplate.execute("insert into user(name,age)values('小黑',11)");


        Long v = (Long)jdbcTemplate.queryForObject("select id from user limit 1", Long.class);
        System.out.println(v);
    }
}